//
//  DiscoverPageTool.m
//  MindBox
//
//  Created by MS on 16-1-13.
//  Copyright (c) 2016年 Lemon. All rights reserved.
//

#import "Discover_WelfarePageTool.h"
#import "INTERFACE.h"
#import "Gift_Goods_Model.h"
@implementation Discover_WelfarePageTool

+ (void)discover_welfarePage_HeaderDataWithCat_id:(NSString *)cat_id Success:(void (^)(Welfare_Detail  * data))success
                                          failure:(void (^)( NSError *error))failure;
{
    
    NSString * url = Welfare_Header_URL(cat_id);
    
    [LGHttpTool GET:url parameters:nil success:^(id responseObject) {
        
        Welfare_DetailModel * data = [Welfare_DetailModel mj_objectWithKeyValues:responseObject];
        Welfare_Detail * weldata = data.data;
        if (success) {
            
            success(weldata);
        }
        
    } failure:^(NSError *error) {
        
        if (failure) {
            failure(error);
        }
    }];

    
    
}


+ (void)discover_welfarePage_ItemGoods_DataWithCat_id:(NSString *)wel_cat_id seach_code:(NSString *)search_code pages:(int)pages Success:(void (^)( NSArray * data))success failure:(void (^)( NSError *error))failure
{
    NSString * url = Welfare_Goods_URL(wel_cat_id,search_code,pages);
    
    [LGHttpTool GET:url parameters:nil success:^(id responseObject) {
        
        Gift_Goods_Model * goodsData = [Gift_Goods_Model mj_objectWithKeyValues:responseObject];
        NSArray * data = goodsData.data;
        
        if (success) {
            
            success(data);
        }
        
    } failure:^(NSError *error) {
        if (failure) {
            failure(error);
        }
        
    }];

    
}
@end
